/*******************************************************
> Copyright (C) 2024 ==IOT== All rights reserved.
> File Name: test.cpp
> Author: IOT
> Website:www.slq.org
> Created Time: 2024年10月29日 星期二 11时35分19秒
***************************************************/

#include <iostream>
#include "queue.h"
using namespace std;

// 设计socket类
class Socket {
	public:
		int fd;
		string ip;	
		
		Socket() : fd(-1), ip("")
		{
		}
		Socket(int _fd, string s) : fd(_fd), ip(s)
		{}
		void show()
		{
			cout << "fd = " << fd << ", ip:" << ip << endl;
		}
		void set(int _fd, const string& _ip)
		{
			fd = _fd;
			ip = _ip;
		}
};

int main(int argc,const char* argv[])
{
	Queue<Socket> task_queue;
	Socket sock(3, "192.168.1.5");
	task_queue.push(sock);
	cout << "size = " << task_queue.size() << endl;
	task_queue.front().show();
	
	sock.set(4, "192.168.1.6");
	task_queue.push(sock);
	cout << "size = " << task_queue.size() << endl;
	task_queue.back().show();
	
#if 0 
	Queue<int> myqueue;
	int myint;

	cout << "Please enter some integers (enter 0 to end):\n";
	do {
		cin >> myint;
		myqueue.push (myint);
	} while (myint);

	cout << "myqueue contains: ";
	while (!myqueue.empty()) {
		cout << ' ' << myqueue.front();
		myqueue.pop();
	}
	cout << '\n';
#endif
    return 0;
}

